package org.gas.barapraja.db.dao.impl;

import javax.persistence.Query;

import org.gas.barapraja.db.dao.AccountDao;
import org.gas.barapraja.db.dao.GasEntityDao;
import org.gas.barapraja.db.entity.Account;
import org.gas.barapraja.util.AppContext;
import org.springframework.stereotype.Repository;

@Repository(AppContext.ACCOUNT_DAO)
public class AccountDaoImpl extends GasEntityDao<Account, Long> implements AccountDao {

	public AccountDaoImpl() {
		super();
	}

	
	public Account findByNumber(String number) {
		Query query=entityManager.createQuery("select a from Account a where a.companyNumber=?1");
		query.setParameter(1, number);
		return (Account)query.getSingleResult();
	}

	
	public Account findBySystemId(String systemId) {
		Query query=entityManager.createQuery("select a from Account a where a.systemId=?1");
		query.setParameter(1, systemId);
		return (Account)query.getSingleResult();
	}

	

}
